﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "StaticTowards", menuName = "BulletMotion/StaticTowards")]
public class StaticTowards : BulletMotion
{
    [Tooltip("要面朝的方向")]
    public Vector2 towards;

    public StaticTowards(float awake, float life, Vector2 t)
    {
        awakeTime = awake;
        lifeTime = life;
        towards = t;
    }

    public override void Awaking(float t)
    {
        base.Awaking(t);
        lifeTime = awakeTime + 1;
    }

    public override Vector2 Motion(float t)
    {
        if (awake)
        {
            motionController.towards = towards.normalized;
            lifeTime = 0;
        }
        return Vector2.zero;
    }
}
